package com.aegean.MonitorExamSYS.examinee.interceptor;

import java.util.Map;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.aegean.MonitorExaxSYS.model.ExamineeValue;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
@Controller("ExamineeInterceptor")
@Scope("prototype")
public class ExamineeInterceptor extends AbstractInterceptor {

	@Override
	public String intercept(ActionInvocation arg0) throws Exception {
		// TODO Auto-generated method stub
		ActionContext context = arg0.getInvocationContext();
		Map session = context.getSession();
		ExamineeValue examinee = (ExamineeValue) session.get("UserLogin");
		if (examinee == null) {
			return ActionSupport.LOGIN;
		} else {
			return arg0.invoke();
		}
	}

}
